package com.yyks.cnbooking.dubbo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import java.util.Date;
import java.util.TimeZone;

/**
 * spring-cloud http
 * 应为该模块不引入 DB，所以需要排除
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class})
@EnableFeignClients
@Slf4j
public class CnbookingCloudConsumerApplication {

    public static void main(String[] args) {
        //时区设置，避免服务以后放到docker容器中有时差问题
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
        log.info("system time:[{}]", new Date().toString());
        log.info("timezone:[{}]", System.getProperty("user.timezone"));
        SpringApplication.run(CnbookingCloudConsumerApplication.class);
    }

    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
